﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MemoryGames.Helpers
{
	static class Extensions
	{
		/// <summary>
		/// Parses the given text to an integer. A default value will be returned if the text is empty or null.
		/// </summary>
		/// <param name="text"></param>
		/// <param name="defaultValue"></param>
		/// <returns></returns>
		public static int ParseIntDefault(this string text, int defaultValue)
		{
			if (String.IsNullOrEmpty(text)) return defaultValue;
			
			return int.Parse(text);
		}
	}
}
